
function* foo() {
    console.log(111)
    try {
        yield 222
    } catch (error) {
        console.log(error);
    }
    console.log(333)
    yield 444
}
const bar = foo()

// return方法相当于直接终止
console.log(bar.next());
console.log(bar.return(10));
console.log(bar.next());
console.log(bar.next());

// throw方法会继续执行，只是捕获异常
// console.log(bar.next());
// console.log(bar.throw('错误信息'));
// console.log(bar.next());






